//@ts-ignore,引入类型
import type { PageResult, PageParams } from "@/types/global.ts";
import type { BannerItem, CategoryItem, HotItem, GuessItem } from "@/types/home";
//@ts-ignore,引入封装的uni.request()
import { http } from "@/utils/http.ts";
/**
 * API接口
*/

//获取首页广告轮播图
//distributionSite:广告区域展示位置(投放位置，1为首页，2为分类商品页),默认为1
export const reqHomeBanner = (distributionSite = 1) => {
    return http<BannerItem[]>({
        url:"/home/banner",
        method:"GET",
        data:{
            distributionSite
        }
    })
}

//获取首页前台分类
export const reqHomeCategory = () => {
    return http<CategoryItem[]>({
        url:"/home/category/mutli",
        method:"GET"
    })
}

//获取首页热门推荐板块
export const reqHomeHot = () => {
    return http<HotItem[]>({
        url:"/home/hot/mutli",
        method:"GET"
    })
}

//首页猜你喜欢数据
export const reqHomeGoodsGuessLike = (data?:PageParams) => {
    return http<PageResult<GuessItem>>({
        url:"/home/goods/guessLike",
        method:"GET",
        data:data
    })
}